package com.gongzhiyun.springboot3test.entity.dialogue;

import com.baomidou.mybatisplus.annotation.*;
import com.gongzhiyun.springboot3test.validate.CommonValidate;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
@TableName("private_messages")
@Schema(description = "私聊消息表")
public class PrivateMessages implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "主键")
    private Integer id;
    @TableField(updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "发送者id")
    private Integer senderId;
    @TableField(updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "接收者id")
    private Integer receiverId;
    @NotBlank(message = "内容不能为空",groups = {CommonValidate.add.class})
    @Schema(description = "内容")
    private String content;
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "发送时间")
    private Date sentAt;
    @Schema(description = "是否已读")
    private boolean isRead;
    @TableField(insertStrategy = FieldStrategy.NEVER)
    @Schema(description = "发送者删除状态")
    private String deletedBySender;
    @TableField(insertStrategy = FieldStrategy.NEVER)
    @Schema(description = "接收者删除状态")
    private String deletedByReceiver;
}
